﻿using System;
using Game1942.Library.Background;
using Game1942.Library.FlightPlans;

namespace Game1942.Library.Planes
{
    public  class Aircraft : ComputerElement
    {     
        
        protected EnergyCounter energy;
        
        // forces the flightplan be changed to Escape
        public virtual void Escape()
        {
            //manageTurn = new TurnManager(Constants.EscapeSpeed,0);
            flightPlan = new EscapePlan(ActualPosition);
        }

        public override void CrashWith(Element intruder)
        {
            if (intruder.IsEnemy(this))
            {
                energy.Value = intruder.HarmSomebody(energy.Value);
                if (energy.Value == 0)
                {
                    Destroy();
                }
            }
        }

        

        public virtual void Shoot(){}

        public override void Live()
        {
            if (manageTurn.AllowShoot())
            {
                Shoot();
            }
            //if(manageTurn.AllowMove())
            //{
                Move();
            //}
            manageTurn.Next();
        }
    }
}
